package com.xinchuang.mapper.targetSystem.damage;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xinchuang.entity.targetSystem.damage.HurtBasicCorrelation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * HS计算标准 Mapper 接口
 * </p>
 *
 * @author baomidou
 * @since 2024-04-26
 */
@Mapper
public interface HurtBasicCorrelationMapper extends BaseMapper<HurtBasicCorrelation> {

    @Update("update t_hurt_basic_correlation set data_status = 1 where hurt_basic_id in (${ids})")
    void deleteWithLogic(@Param(value = "ids") String ids);

    @Select("SELECT * FROM t_hurt_basic_correlation WHERE hurt_basic_id = (SELECT id FROM t_hurt_basic WHERE target_type_id = #{targetClassify} AND destroy_level = #{destroyLevel} AND data_status = 0)")
    List<HurtBasicCorrelation> getSubTargetByDestroyLevel(@Param(value = "targetClassify") String targetClassify, @Param(value = "destroyLevel") String destroyLevel);
}
